Amiga Active list (748/1044)

From:Matt
Date:23 Sep 2001 at 19:20:48
Subject:[amigactive] Re: html: how to close a window...?

Hello Jonathan

On 23-Sep-01, you wrote:

> Hi
>
> I want to create a link on my website so that when the link is followed, a
> new window is opened and the user is transported to someone else's website,
> BUT with a small banner along the top with the logo of my site, a couple of
> lines of text, and a couple of links: one link to remove the banner, the
> other to close the window.
>
> So far I have got everything working by using 2 frames, my only problem is
> creating a text link within the "banner frame" that will close the window.
> How do I do this, I guess it's javascript?
>
> I found an example:
> <a href="javascript:window.close()">close me</a>
>
> but I've two problems with it, pressumably cos I've missed something:
>
> 1. In IE it brings up a message box saying: "the web page you are viewing is
> trying to close the window. Do you want to close the window?"

This is good. Security reason.

If the window is opened by a script it can be closed by a script. If it
is opened by a user or a normal link, it cannot be closed by script
without user interaction.

> 2. It only works like the above if i view the "banner" html page, i.e. it
> does not work (nothing happens) if viewing the page that combines the banner
> AND the page I'm linking to.

??

If you want to specify a window to close you need to find out it's name, or
assign it to a variable:

myWin = window.open("http://www.mysite.com/banner.html");

and then myWin.close(); from the document that called it, or window.close();
from inside that document.

It isn't entirely clear what you want to do, you mixed and matched a few terms
(and don't ever ever use frames unless some other site forces you since you WILL
be mauled by competant web developers :)

Thanks



Matt

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Pinpoint the right security solution for your company- Learn how to add 128- bit encryption and to authenticate your web site with VeriSign's FREE guide!
http://us.click.yahoo.com/JNm9_D/33_CAA/yigFAA/dpFolB/TM
---------------------------------------------------------------------~->

Quote carefully and read all ADMIN:README mails
To unsubscribe mailto:amigactive-unsubscribe@yahoogroups.com
Anyone sending unsubscribe messages to the list will be SHOT!

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/